import 'package:flutter/material.dart';

import 'package:state_flutter/components/TabBar/tabbar.dart';

class OrderPage extends StatefulWidget {
  OrderPage({Key key}) : super(key: key);

  @override
  _OrderPageState createState() => _OrderPageState();
}

class _OrderPageState extends State<OrderPage> {
  
  Map data;

  @override
  void initState() { 
    super.initState();
    
    this.data = {
      'title': 'OrderPage',
      'tabs': <Tab>[
        Tab(text: '未支付',),
        Tab(text: '已购买',),
        Tab(text: '已超时',)
      ],
      'body': <Widget>[
        Unpay(),
        Text('已购买'),
        Text('已超时'),
      ]
    };
  }
  
  @override
  Widget build(BuildContext context) {
    return TabBarController(this.data);
  }
}

/*
 *  未支付组件 
 */
class Unpay extends StatefulWidget {
  Unpay({Key key}) : super(key: key);

  @override
  _UnpayState createState() => _UnpayState();
}

class _UnpayState extends State<Unpay> {
  @override
  Widget build(BuildContext context) {
    return Center(child: Text('未支付'),);
  }
}